<?php
/**
 * Created by PhpStorm.
 * User: lenovo
 * Date: 2018/10/20
 * Time: 17:35
 */
header("content-type:text/html;charset=utf-8");
require COMMON_PATH.'logTool.class.php';
require COMMON_PATH.'message.class.php';
class GoodAction extends Action
{
    //获取套餐信息
    public function getGood(){
        $back = message::fail('fail');
        $good = M('good');
        //查询条件
        $where = array(
            'status' => 1,      //激活状态
            'delete' => 1       //未删除状态
        );
        $data = $good->where($where)->select();
        if ($data){
            foreach ($data as $item=>$value){
                $class_id = $value['class'];
                $class = M('good_class');
                $class_name = $class->where("id={$class_id}")->getField('class');
                $data[$item]['class_name'] = $class_name;
            }
            $back = message::success('success',$data);
        }
        logTool::logCat('前台获取套餐信息: '.$back);
        echo $back;
        return;
    }
}